package org.hot100_5.leetcode24;

import org.leetcode.easy.ListNode;

public class Solution {
    public ListNode swapPairs(ListNode head) {

        if (head == null || head.next == null) {
            return head;
        }

        ListNode first = head;
        ListNode two = head.next;
        ListNode three = two.next;
        two.next = first;
        first.next = swapPairs(three);

        return two;
    }
}
